<template>
  <div class="XinZeng">
    <el-form-item label="用户名称">
      <el-input
        v-model="userData.username"
        type="text"
        placeholder="请输入用户名称"
      ></el-input>
    </el-form-item>
    <el-form-item label="用户密码">
      <el-input
        v-model="userData.password"
        type="text"
        placeholder="请输入用户密码"
      ></el-input>
    </el-form-item>
    <el-form-item label="昵称">
      <el-input
        v-model="userData.nickname"
        type="text"
        placeholder="请输入昵称"
      ></el-input>
    </el-form-item>
    <el-form-item label="电话">
      <el-input
        v-model="userData.phone"
        type="text"
        placeholder="请输入电话"
      ></el-input>
    </el-form-item>
    <el-form-item label="用户分数">
      <el-input
        v-model="userData.point"
        type="text"
        placeholder="请输入分数"
      ></el-input>
    </el-form-item>
  </div>
</template>
  
  <script setup>
import { defineProps, watch, reactive, defineEmits } from "vue";

const props = defineProps({
  data: {
    type: Object,
  },
});

const emits = defineEmits(["updateUserData"]);

const userData = reactive({
  id: props.data.id,
  username: props.data.username,
  password: props.data.password,
  nickname: props.data.nickname,
  phone: props.data.phone,
  point: props.data.point,
});
watch(userData,()=>{
  console.log(userData);
  emits("updateUserData", userData)
})
</script>
  
  <style lang="less" scoped>
.tianjia {
  padding: 30px 0;
}

.col {
  height: 38px;
}

.input {
  width: 200px;
}

.button {
  width: 70px;
  margin-left: 20px;
  margin-bottom: 30px;
}
</style>